import { S } from '../../s';
import { IPSChartSeriesCSCartesian2DEncode } from './ipschart-series-cscartesian2-dencode';
import { IPSChartXAxis } from './ipschart-xaxis';
import { IPSChartYAxis } from './ipschart-yaxis';
import { IPSDEChart } from './ipsdechart';
import { PSDEChartSeriesEncodeImplBase } from './psdechart-series-encode-impl-base';

export class PSDEChartSeriesCSCartesian2DEncodeImpl
  extends PSDEChartSeriesEncodeImplBase
  implements IPSChartSeriesCSCartesian2DEncode
{
  protected pschartxaxis: IPSChartXAxis;
  getPSChartXAxis(): IPSChartXAxis | null {
    if (this.pschartxaxis != null) return this.pschartxaxis;
    const value = this.M.getPSChartXAxis;
    if (value == null) {
      return;
    }
    const ipsdechart = this.getParentPSModelObject(S._253) as IPSDEChart;
    if (ipsdechart != null) {
      this.pschartxaxis = ipsdechart.findPSChartXAxis(value);
    }
    return this.pschartxaxis;
  }

  protected pschartyaxis: IPSChartYAxis;
  getPSChartYAxis(): IPSChartYAxis | null {
    if (this.pschartyaxis != null) return this.pschartyaxis;
    const value = this.M.getPSChartYAxis;
    if (value == null) {
      return;
    }
    const ipsdechart = this.getParentPSModelObject(S._253) as IPSDEChart;
    if (ipsdechart != null) {
      this.pschartyaxis = ipsdechart.findPSChartYAxis(value);
    }
    return this.pschartyaxis;
  }
  protected x: string[];
  getX(): string[] | null {
    if (this.x == null) {
      const value = this.M.x;
      if (value == null) {
        return null;
      }
      const arrayNode: any[] = value;
      if (arrayNode.length == 0) {
        return null;
      }
      const list: string[] = [];
      for (let i = 0; i < arrayNode.length; i++) {
        list.push(arrayNode[i]);
      }
      this.x = list;
    }
    return this.x;
  }
  protected y: string[];
  getY(): string[] | null {
    if (this.y == null) {
      const value = this.M.y;
      if (value == null) {
        return null;
      }
      const arrayNode: any[] = value;
      if (arrayNode.length == 0) {
        return null;
      }
      const list: string[] = [];
      for (let i = 0; i < arrayNode.length; i++) {
        list.push(arrayNode[i]);
      }
      this.y = list;
    }
    return this.y;
  }
  get cls(): string {
    return 'PSDEChartSeriesCSCartesian2DEncodeImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._10d) return true;
    return super.instanceof(cls);
  }
}
